package com.lzh.exer;

/*
 * 
 * [a,b]
 * 公式：(int)(Math.random() * (b-a+1)+a)
 * 
 */
public class ArrayExer3 {

	public static void main(String[] args) {

		int[] arr = new int[10];

		for (int i = 0; i < arr.length; i++) {
			arr[i] = (int) (Math.random() * (99 - 10 + 1) + 10);
			System.out.println(arr[i]);
		}

		System.out.println("************");

		// 求数组元素的最大值
		int maxNum = 0;
		int minNum = arr[1];
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] > maxNum) {
				maxNum = arr[i];
			}

			if (arr[i] < minNum) {
				minNum = arr[i];
			}
		}
		System.out.println("最大值："+maxNum);
		System.out.println("最小值："+minNum);
	}
}
